﻿var status = 0;

var tz3 = "#fEffect/CharacterEff/1082588/0/0#"; //红点
var tz4 = "#fEffect/CharacterEff/1082588/3/0#"; //蓝点

function start() {
	status = -1;
	action(1, 0, 0);
}

function action(mode, type, selection) {
	if (status == 0 && mode == 0) {
		cm.dispose();
		return;
	}
	if (mode == 1) {
		status++;
	} else {
		status--;
	}
	if (status == 0) {
		var selStr = "";
		selStr += "#e#d\t\t  " + tz4 + "" + tz3 + "" + cm.getServerName() + " 神秘徽章 " + tz3 + "" + tz4 + "#n#k\r\n \r\n#b";
		selStr += "  #L1#" + tz4 + "200级可以领取#z1712000##v1712000#x1#l\r\n";
		selStr += "  #L2#" + tz4 + "210级可以领取#z1712001##v1712001#x1#l\r\n";
		selStr += "  #L3#" + tz4 + "220级可以领取#z1712002##v1712002#x1#l\r\n";
		cm.sendSimpleS(selStr, 2);
	} else if (status == 1) {
		if (!cm.canHoldSlots(1)) {
			cm.sendOk("背包空间不足！");
			cm.dispose();
			return;
		}
		switch (selection) {
			case 1:

				if (cm.getPQLog("1712000", 1) > 0) {
					cm.sendOk("你已经领取过了。");
					cm.dispose();
					return;
				}
				if (cm.getPlayer().getLevel() >= 200) {
					cm.gainItem(1712000, 1);
					cm.setPQLog("1712000", 1);
					cm.sendOk("领取#z1712000##v1712000#成功");
				} else {
					cm.sendOk("你的等级不够哦,领取#z1712000##v1712000#需要200级");
				}
				cm.dispose();
				break;
			case 2:
				if (cm.getPQLog("1712001", 1) > 0) {
					cm.sendOk("你已经领取过了。");
					cm.dispose();
					return;
				}
				if (cm.getPlayer().getLevel() >= 210) {
					cm.gainItem(1712001, 1);
					cm.setPQLog("1712001", 1);
					cm.sendOk("领取#z1712001##v1712001#成功");
				} else {
					cm.sendOk("你的等级不够哦,领取#z1712001##v1712001#需要210级");
				}
				cm.dispose();
				break;
			case 3:
				if (cm.getPQLog("1712002", 1) > 0) {
					cm.sendOk("你已经领取过了。");
					cm.dispose();
					return;
				}
				if (cm.getPlayer().getLevel() >= 220) {
					cm.gainItem(1712002, 1);
					cm.setPQLog("1712002", 1);
					cm.sendOk("领取#z1712002##v1712002#成功");
				} else {
					cm.sendOk("你的等级不够哦,领取#z1712002##v1712002#需要220级");
				}
				cm.dispose();
				break;
			case 4:
				if (cm.getPQLog("1712003", 1) > 0) {
					cm.sendOk("你已经领取过了。");
					cm.dispose();
					return;
				}
				if (cm.getPlayer().getLevel() >= 230) {
					cm.gainItem(1712003, 1);
					cm.setPQLog("1712003", 1);
					cm.sendOk("领取#z1712003##v1712003#成功");
				} else {
					cm.sendOk("你的等级不够哦,领取#z1712003##v1712003#需要230级");
				}
				cm.dispose();
				break;
			case 5:
				if (cm.getPQLog("1712004", 1) > 0) {
					cm.sendOk("你已经领取过了。");
					cm.dispose();
					return;
				}
				if (cm.getPlayer().getLevel() >= 240) {
					cm.gainItem(1712004, 1);
					cm.setPQLog("1712004", 1);
					cm.sendOk("领取#z1712004##v1712004#成功");
				} else {
					cm.sendOk("你的等级不够哦,领取#z1712004##v1712004#需要240级");
				}
				cm.dispose();
				break;
			case 6:
				if (cm.getPQLog("1712005", 1) > 0) {
					cm.sendOk("你已经领取过了。");
					cm.dispose();
					return;
				}
				if (cm.getPlayer().getLevel() >= 250) {
					cm.gainItem(1712005, 1);
					cm.setPQLog("1712005", 1);
					cm.sendOk("领取#z1712003##v1712003#成功");
				} else {
					cm.sendOk("你的等级不够哦,领取#z1712005##v1712005#需要250级");
				}
				cm.dispose();
				break;
			default:
				cm.sendOk("该功能正在紧张进行制作中，请耐心等待。");
				cm.dispose();
				break;
		}
	}
}